package model;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class Interval {

	public int start;
	public int end;

	public Interval(int start, int end) {
		this.start = start;
		this.end = end;
	}

	public Interval(Interval other) {
		this(other.start, other.end);
	}

	public boolean equals(Object obj) {
		if (!(obj instanceof Interval))
			return false;
		Interval other = (Interval) obj;
		return (start == other.start) && (end == other.end);
	}

	public String toString() {
		return "[" + start + ", " + end + "]";
	}

	public void acommodate(Interval other) {
		start = min(other.start, start);
		end = max(other.end, end);
	}
}
